Skip to main content

Comment Post

POST /post/:postId/comment

Description

Creates a new top-level comment on a post.

Request Parameters

Requires Authentication: true

PATH PARAMS

NameTypeRequiredDescription
postIdstringYesMongoDB post ID.

BODY

NameTypeRequiredDescription
commentstringYesComment text.
gifstringNoGiphy GIF ID.

Usage Example

await axios.post(
"https://api.daykeeper.app/post/66cbbea31e854f3d7995c1f0/comment",
{
comment: "Nice post",
gif: "EoVWPQErq3RPo6EZah"
},
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
}
)

Success Response

{
"message": "Comment created successfully",
"post": {
"_id": "66cbbea31e854f3d7995c1f0"
},
"comment": {
"_id": "66ef265c8f073b81cb3b3900",
"comment": "Nice post"
}
}

Error Response

CodeDescription
400Comment missing
404Post not found
413Comment too long
500Server error